<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        html,
        body {
            height: 100%;
        }

        #app {
            height: 100%;
            position: relative;
            background-color: rgba(0, 0, 0, .5);
        }

        .shopcart {
            padding: 20px;
            position: fixed;
            bottom: 0;
            background-color: white;
            width: 100%;
            box-sizing: border-box;
            padding-bottom: 80px;
        }

        .shopcart .title {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;

        }

        .shopcart .title span:nth-child(1) {
            font-weight: bold;
        }

        .shopcart .good {
            margin: 5px 0;
            display: flex;
        }

        .shopcart .good .imgbox {
            width: 80px;
            margin-right: 8px;
        }

        .shopcart .good .imgbox img {
            width: 100%;
        }

        .shopcart .good .text {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .shopcart .good .text .name {
            font-weight: bold;
        }

        .shopcart .list .good .text .price {
            display: flex;
            justify-content: space-between;
        }

        .shopcart .good .text .price span {
            display: inline-block;
            width: 14px;
            height: 14px;
            text-align: center;
            line-height: 14px;
            background-color: rgb(111, 251, 251);
            color: white;
            border-radius: 50%;
        }

        .shopcart .good .text .price span:nth-child(2) {
            color: black;
            background-color: white;
        }

        .shopcart .count {
            width: 100%;
            height: 80px;
            position: fixed;
            bottom: 0;
            left: 0;
            display: flex;
            justify-content: space-between;
            background-color: #f5f5f5;
            padding: 20px 20px;
            box-sizing: border-box;
        }

        .shopcart .count .countsum span {
            display: inline-block;
            margin-right: 5px;
        }

        .shopcart .count .jiesuan {
            text-align: center;
            line-height: 40px;
            width: 80px;
            height: 40px;
            background-color: rgb(21, 207, 61);
            color: white;
            border-radius: 4px;
        }

        .shopcart .list .empty {
            width: 100%;
            padding: 100px 0;
            text-align: center;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="shopcart">
            <div class="title">
                <span>已选商品</span>
                <span @click="clear">清空</span>
            </div>
            <div class="list">
                <div class="good" v-for="(item,index) in list">
                    <div class="imgbox">
                        <img :src="item.pic" alt="">
                    </div>
                    <div class="text">
                        <div class="name">{{item.name}}</div>
                        <div class="price">
                            <div>￥{{item.price}}</div>
                            <div>
                                <span @click="sub(item)">-</span>
                                <span>{{item.count}}</span>
                                <span @click="add(item)">+</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="empty" v-show="list.length == 0">购物车空空如也，去逛逛!</div>
            </div>
            <!-- 商品总数 -->
            <div class="count">
                <div class="countsum">
                    <span>总数:{{zongshu}}</span>
                    <span>￥{{zongjia}}</span>
                </div>
                <div class="jiesuan">
                    去结算
                </div>
            </div>
        </div>
    </div>
</body>

</html>
<script src="vue-2.5.21.js"></script>
<script src="01.购物车.js"></script>